<#-- Dialog -->
<#macro Dialog title id autoOpen=false style="" resizable=true class="Dialog" buttons=[]>
	<#if id=="">
		<#assign DialogId="Dialog_${GetUniqueIndex()}"/>
	<#else>
		<#assign DialogId=id/>
	</#if>
	<div id="${DialogId}" title="${title}" class="${class}" style="${style}">
		<#nested>
	</div>
    <script type="text/javascript">
		$(document).ready(function(){
			$( "#dialog:ui-dialog" ).dialog( "destroy" );
			$( "#${DialogId}").dialog({
				autoOpen: ${autoOpen?string},
				modal: true,
				resizable:${resizable?string},
				buttons: [<#list buttons as button>${button}<#if button_index lt buttons?size>,</#if></#list>]
			});
		});
	</script>
</#macro>

<#-- ConfirmDialog -->
<#macro ConfirmDialog id title="确定对话框" onok="" style="" href="" target="" oncancel="" cancelhref="" havecancel=true >
	<#assign buttons=['{
				        text: "确定",
				        click: function() {${onok}; $(this).dialog("close"); }
				    	}','{
				        text: "取消",
				        click: function() {${oncancel}; $(this).dialog("close"); }
				    	}']/>
    
    <@Dialog id=id title=title style="${style}" resizable=false class="ConfirmDialog" buttons=buttons>
        <nobr><#nested></nobr>
    </@Dialog>
</#macro>